<?php/*  PHP version 5  Copyright (c) 2002-2019ECISP.CN、EarcLink.COM  警告：这不是一个免费的软件，请在许可范围内使用，请尊重知识产权，侵权必究，举报有奖  作者：黄祥云 E-mail:6326420@qq.com  QQ:6326420 TEL:18665655030 / 13797552220*/


$module_array = espcms_action_url($action);

$espcms_admin_templates = espcms_admin_template();

$espcms_db_cache = espcms_start_cache();

require_once(ESPCMS_FILE_ROOT . 'espcms_public/espcms_db.php');

require_once(ESPCMS_FILE_ROOT . 'espcms_public/espcms_dbsave.php');

$module_filename = ESPCMS_FILE_ROOT . ESPCMS_ADMIN_DIRNAME . '/control/' . $module_array['module'] . '.php';
if (!is_file($module_filename)) {
    espcms_message_err('public_pack-espcms_module_file_err', array($action));
}

include $module_filename;

global $module_array;

$module = $module_array['module'];
$method = $module_array['method'];
if (method_exists($module, $method)) {
    $control = new $module;
    $control->$method();
} else {
    $methodName = $module_array['module'] . '/' . $module_array['method'];
    espcms_message_err('public_pack-espcms_method_name_err', array($methodName));
}

function __autoload($class) {
    if (!$class) {
        espcms_message_err('public_pack-espcms_method_class_err', array($class));
    }
    $class_array = explode('\\', $class);
    if (!$class_array[0]) {
        espcms_message_err('public_pack-espcms_method_class_err', array($class));
    }

    $isObject = false;

    switch ($class_array[0]) {
        case 'application':
            $class_array[0] = 'espcms_public';
            $classFile = implode('/', $class_array);
            $isObject = true;
            break;
        case 'modul_application':
            $class_array[0] = 'espcms_interface';
            $classFile = implode('/', $class_array);
            $isObject = true;
            break;
        case 'inc_application':
            $class_array[0] = 'espcms_includes';
            $classFile = implode('/', $class_array);
            $isObject = true;
            break;
        case 'admin_application':
            $class_array[0] = ESPCMS_ADMIN_DIRNAME . '/espcms_admin_includes';
            $classFile = implode('/', $class_array);
            $isObject = true;
            break;
        case 'modelApplication':
            $class_array[0] = ESPCMS_APP_DIR;
            $classFile = implode('/', $class_array);
            $isObject = true;
            break;
        default:
            break;
    }
    if ($isObject) {
        $file = ESPCMS_FILE_ROOT . $classFile . '.php';
        if (!is_file($file)) {
            espcms_message_err('public_pack-espcms_module_file_err', array($class));
        } else {
            include_once($file);
        }
    }
}
